package com.zhidisoft.system.vo;

import com.zhidisoft.system.entity.Function;

public class MenuVO {
	
	private String id;
	
	private String name;
	
	private String url;
	
	private String pId;
	
	private Boolean open;
	
	private Boolean checked;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getpId() {
		return pId;
	}

	public void setpId(String pId) {
		this.pId = pId;
	}

	public Boolean getOpen() {
		return open;
	}

	public void setOpen(Boolean open) {
		this.open = open;
	}

	public Boolean getChecked() {
		return checked;
	}

	public void setChecked(Boolean checked) {
		this.checked = checked;
	}
	
	public static MenuVO fromFunction(Function func){
		if(func != null){
			MenuVO vo = new MenuVO();
			vo.setId(func.getId());
			vo.setName(func.getFuncName());
			vo.setUrl(func.getFuncURL());
			if(func.getParent()!=null){
				vo.setpId(func.getParent().getId());
			}else{
				vo.setpId(null);
			}
			return vo;
		}
		return null;
	}

}
